﻿(function () {
	rf.news =
		{
			settings: {
				urls: {
					refreshGrid: null
				},
				vars: {
				},
				elements: {
					pager: '#news-pager',
					content: '#news-content'
				}
			},

			init: function (settings) {
				$.extend(true, rf.news.settings, settings);
				rf.news.initGrid();
			},
			
			initGrid: function () {
				rf.news.initPager();
			},
			
			refresh: function (content, refreshUrl, pageNumber) {
				$(content).loadData(refreshUrl,
					{ pageNumber: pageNumber },
					function () { rf.news.initGrid(); });
			},
			
			initPager: function () {
				$(rf.news.settings.elements.pager).pager(function (page) {
					rf.news.refresh(rf.news.settings.elements.content, rf.news.settings.urls.refreshGrid, page);
				});
			}
		};
})();